import request from '@/router/axios'

const path = '/ykdgrjbxxs'

export function delObj(id) {
  return request({
    url: `${path}/${id}`,
    method: 'delete'
  })
}

export function addObj(obj) {
  return request({
    url: `${path}`,
    method: 'post',
    data: obj
  })
}

export function updateObj(obj) {
  return request({
    url: `${path}`,
    method: 'put',
    data: obj
  })
}

export function getObj(id) {
  return request({
    url: `${path}/` + id,
    method: 'get'
  })
}

export function getIdCard() {
  return new Promise((resolve, reject) => {
    window.$.get(
      'http://127.0.0.1:24010/ZKIDROnline/ScanReadIdCardInfo?OP-DEV=1&CMD-URL=4',
      function(data) {
        resolve({ data: data })
      },
      function(error) {
        reject(error)
      }
    )
  })
}
// export function getIdCard() {
//   return request({
//     url: `http://127.0.0.1:24010/ZKIDROnline/ScanReadIdCardInfo?OP-DEV=1&CMD-URL=4`,
//     method: 'get'
//   })
// }

export function getObjByIdCard(obj) {
  return request({
    url: `${path}/findinfo`,
    method: 'post',
    data: obj
  })
}
